/*
 * @Author: 小孩_晓孩 1534579168@qq.com
 * @Date: 2024-08-16 15:07:15
 * @LastEditors: 小孩_晓孩 1534579168@qq.com
 * @LastEditTime: 2024-08-26 14:17:27
 * @FilePath: \heima-shop\src\pages\goods\request.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { http } from '@/utils/http.ts'
import type { GoodsResult } from './goods'
import type { AddressParams, AddressItem } from '@/types/address'

/**
 * 商品详情
 * @param id 商品id
 */
export const getGoodsByIdAPI = (id: string) => {
  return http<GoodsResult>({
    method: 'GET',
    url: '/goods',
    data: { id },
  })
}
/**
 * 加入购物车
 * @param data 请求体参数
 */
export const postMemberCartAPI = (data: { skuId: string; count: number }) => {
  return http({
    method: 'POST',
    url: '/member/cart',
    data,
  })
}

export const getMemberAddressAPI = () => {
  return http<AddressItem[]>({
    method: 'GET',
    url: '/member/address',
  })
}
